bitkeeper revision 1.210 (3eb83c4fHs_yAKLhRwEjFTSk2RBfhA)
authortlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>
Tue, 6 May 2003 22:50:55 +0000 (22:50 +0000)
committertlh20@elite.cl.cam.ac.uk <tlh20@elite.cl.cam.ac.uk>
Tue, 6 May 2003 22:50:55 +0000 (22:50 +0000)
xi_list:
  new file
dom0_core.c, sched.h, domain.c:
  Add default domain name and xi_list to list all running domains

.rootkeys
tools/internal/xi_list [new file with mode: 0755]
xen/common/domain.c
xen/include/xeno/sched.h
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/dom0/dom0_core.c

index c450c67df239665b357eb7a284f08cca6849e946..a842dde4ace442c1722d54f65b6122e4f2cf8681 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
@@ -39,6 +39,7 @@
 3eb781fdgbSkh2O6JQS-65Dz4n0ItQ tools/internal/xi_build.c
 3eb781fdW1SAyiaC4mTsXq_9fRHh-A tools/internal/xi_create.c
 3eb781fdcJ0fF7rWfzAOArW-x4-gwA tools/internal/xi_destroy.c
+3eb83c3bZeECmphOKOJxSu4Lo1LpBw tools/internal/xi_list
 3eb781fd8oRfPgH7qTh7xvgmwD6NgA tools/internal/xi_start.c
 3eb781fd0Eo9K1jEFCSAVzO51i_ngg tools/internal/xi_stop.c
 3eb781fd7211MZsLxJSiuy7W4KnJXg tools/internal/xi_vifinit
diff --git a/tools/internal/xi_list b/tools/internal/xi_list
new file mode 100755 (executable)
index 0000000..bff4633
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# xi_list
+#
+# This is a silly little script to dump the currently running domains.
+# The output format is a series of space-separate fields for each domain:
+#
+#  1. Domain id
+#  2. Processor
+#  3. Has CPU (1 => true, 0 => false)
+#  4. State (RUNNING, INTERRUPTABLE, UNINTERRUPTABLE, WAIT, SUSPENDED, DYING)
+#  5. MCU advance
+#  6. Total pages
+#  7. Name
+
+INPUT_FILE=/proc/xeno/domains
+
+awk -f - $INPUT_FILE <<EOF
+{
+  dom_id = \$1;
+
+  processor = \$2;
+
+  has_cpu = \$3;
+
+  state = "UNKNOWN";
+
+  if (\$4 == 0)  state = "RUNNING";
+  if (\$4 == 1)  state = "INTERRUPTIBLE";
+  if (\$4 == 2)  state = "UNINTERRUPTABLE";
+  if (\$4 == 4)  state = "WAIT";
+  if (\$4 == 8)  state = "SUSPENDED";
+  if (\$4 == 16) state = "DYING";
+
+  mcu_advance = \$6;
+
+  tot_pages = \$8;
+
+  printf "%d %d %d %s %d %d %s", dom_id, processor, has_cpu, state, mcu_advance, tot_pages, \$9;
+  for (i = 10; i < NF; i ++) {
+    printf " %s", \$i;
+  }
+  printf "\n";
+}
+EOF 
index 35154baf37cbc73e5598f9700c16be75fe5ba511..e2a8306357583350485f49d63f722a66e1aadc70 100644 (file)
@@ -48,6 +48,8 @@ struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu)
     p->domain    = dom_id;
     p->processor = cpu;
 
+    sprintf (p->name, "Domain-%d", dom_id);
+
     spin_lock_init(&p->blk_ring_lock);
     spin_lock_init(&p->page_lock);
 
index fe4c49736e8c2ca1691c9db67d50ccfdc17c856e..c5ab334b0061ce797a53a387ff7ac8ef1253484c 100644 (file)
@@ -170,6 +170,9 @@ struct task_struct
  * TASK_WAIT:            Domains CPU allocation expired.
  * TASK_SUSPENDED:       Domain is in supsended state (eg. start of day)
  * TASK_DYING:           Domain is about to cross over to the land of the dead.
+ *
+ * If you update these then please update the mapping to text names in
+ * xi_list.
  */
 
 #define TASK_RUNNING            0
index 4f03fda0e23f0b5909c51115cb311ab3a119e9ad..d4777180e408871dcd695a0f694a20a972b890bc 100644 (file)
@@ -351,6 +351,12 @@ static int xeno_domains_show(struct seq_file *s, void *v)
 { 
   dom0_op_t *di = v;
   
+  /*
+   * Output one domain's details to dom0.
+   *
+   * If you update this format string then change xi_list to match.
+   */
+
   seq_printf (s, 
               "%8d %2d %1d %2d %8d %8ld %p %8d %s\n",
               di -> u.getdominfo.domain,